<html>
<head><meta charset="utf-8"><title>intermittent panic while the program is shutting down. · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/intermittent.20panic.20while.20the.20program.20is.20shutting.20down.2E.html">intermittent panic while the program is shutting down.</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="244179858"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/intermittent%20panic%20while%20the%20program%20is%20shutting%20down./near/244179858" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/intermittent.20panic.20while.20the.20program.20is.20shutting.20down.2E.html#244179858">(Jun 28 2021 at 17:38)</a>:</h4>
<p>I've got a program that, when you press <code>Ctrl+c</code>, will usually quietly shut down, and sometimes will print a long panic-like message as it shuts down:</p>
<div class="codehilite"><pre><span></span><code>error: process didn&#39;t exit successfully: `target\release\stdgame.exe` (exit code: 0xc000013a, STATUS_CONTROL_C_EXIT)
</code></pre></div>
<p>Is this just a common weirdness when getting lines from stdin or should I dig deeper?</p>



<a name="244180699"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/intermittent%20panic%20while%20the%20program%20is%20shutting%20down./near/244180699" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/intermittent.20panic.20while.20the.20program.20is.20shutting.20down.2E.html#244180699">(Jun 28 2021 at 17:45)</a>:</h4>
<p>Based on <a href="https://docs.microsoft.com/en-us/windows/win32/procthread/terminating-a-process">https://docs.microsoft.com/en-us/windows/win32/procthread/terminating-a-process</a> and <a href="https://bugs.python.org/issue43523">https://bugs.python.org/issue43523</a> that seems to be the intended behavior when the default console control handler hasn't been changed.</p>



<a name="244182235"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/intermittent%20panic%20while%20the%20program%20is%20shutting%20down./near/244182235" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/intermittent.20panic.20while.20the.20program.20is.20shutting.20down.2E.html#244182235">(Jun 28 2021 at 17:57)</a>:</h4>
<p>if it <em>always</em> happened that would seem fine, but it usually doesn't:</p>
<div class="codehilite"><pre><span></span><code>D:\dev\stdgame&gt;cargo run --release
   Compiling stdgame v0.0.0 (D:\dev\stdgame)
    Finished release [optimized] target(s) in 2.39s
     Running `target\release\stdgame.exe`
What be they name adventurer? error: process didn&#39;t exit successfully: `target\release\stdgame.exe` (exit code: 0xc000013a, STATUS_CONTROL_C_EXIT)
^C
D:\dev\stdgame&gt;cargo run --release
    Finished release [optimized] target(s) in 0.01s
     Running `target\release\stdgame.exe`
What be they name adventurer?
D:\dev\stdgame&gt;cargo run --release
    Finished release [optimized] target(s) in 0.01s
     Running `target\release\stdgame.exe`
What be they name adventurer?
D:\dev\stdgame&gt;cargo run --release
    Finished release [optimized] target(s) in 0.01s
     Running `target\release\stdgame.exe`
What be they name adventurer?
D:\dev\stdgame&gt;cargo run --release
    Finished release [optimized] target(s) in 0.01s
     Running `target\release\stdgame.exe`
What be they name adventurer?
</code></pre></div>
<p>Most of the time <code>ctrl+c</code> closes the program without any error message.</p>



<a name="244187766"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/intermittent%20panic%20while%20the%20program%20is%20shutting%20down./near/244187766" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Chris Denton <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/intermittent.20panic.20while.20the.20program.20is.20shutting.20down.2E.html#244187766">(Jun 28 2021 at 18:39)</a>:</h4>
<p>Hm, does it ever happen if you run the program directly, without using <code>cargo run</code>?</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>